<?php
	session_start();
	require_once("../db_connect.php");

	$manager_id = htmlspecialchars($_POST['manager_id'],ENT_QUOTES,"UTF-8");

	$Family_Name  = htmlspecialchars($_POST['Family_Name'],ENT_QUOTES,"UTF-8");
	$Given_Name   = htmlspecialchars($_POST['Given_Name'],ENT_QUOTES,"UTF-8");
	$Family_Kana  = htmlspecialchars($_POST['Family_Kana'],ENT_QUOTES,"UTF-8");
	$Given_Kana   = htmlspecialchars($_POST['Given_Kana'],ENT_QUOTES,"UTF-8");

	$Login_ID     = htmlspecialchars($_POST['Login_ID'],ENT_QUOTES,"UTF-8");

	$sql = "UPDATE manager
			SET login_id = ?,family_name = ?,given_name = ?,family_kana = ?,given_kana = ?
			WHERE manager_id = ?";

	$stmt = $db->prepare($sql);

	$data = array($Login_ID,
	              $Family_Name,
                  $Given_Name,
                  $Family_Kana,
                  $Given_Kana,
                  $manager_id
	);

	$res =& $db->execute($stmt, $data);	//SQLを実行して、結果を $res に代入
	if (PEAR::isError($res)) {			//SQLの実行に失敗すればここでエラー文を出力
		die($res->getMessage());
	}

	header("Location: Manager.php");
?>